package cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.goods.controller.admin.goods.vo;

import cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.goods.dal.dataobject.goods.GoodsDO;
import lombok.*;

import java.time.format.DateTimeFormatter;
import java.util.*;
import java.time.LocalDateTime;

import com.alibaba.excel.annotation.ExcelProperty;

/**
 * 小程序-商品 Excel VO
 *
 * @author 芋道源码
 */
@Data
public class GoodsExcelVO {

    @ExcelProperty("id主键")
    private Integer id;
    @ExcelProperty("创建时间")
    private String createTime;
    @ExcelProperty("商品名称")
    private String name;
    @ExcelProperty("商品价格")
    private String goodsPrice;
    @ExcelProperty("商品库存")
    private String goodsNum;
    @ExcelProperty("销售数量")
    private Integer saleNum;
    @ExcelProperty("是否包邮")
    private String postage;
    @ExcelProperty("状态")
    private String status;

    public GoodsExcelVO() {
    }

    public GoodsExcelVO(GoodsDO vo) {
        this.id = vo.getId();
        this.createTime = vo.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        this.name = vo.getName();
        this.saleNum = vo.getSaleNum();
        this.postage = vo.getPostage()==1?"是":"否";
        this.status = vo.getStatus()==1?"上架":"下架";
        this.goodsNum=vo.getGoodsSize()==null?"0":vo.getGoodsSize().toString();
        this.goodsPrice=vo.getGoodsPrice()==null?"0":vo.getGoodsPrice().toString();
    }
}

